﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MainScene;

namespace SSShell
{
    public class MLV
    {
        public ClassNode MainScene;
        public string Fairytale = "";
        string Destroy = "Уничтожить";//Уточнить!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

        public MLV(ClassNode MScene)
        {
            MainScene = MScene;
        }

        //-----------------------генерация текста--------------------------------------------------------------------------
        public void GoRoundOfScene(string name)
        {
            int CurrentArc = 0;
            ClassNode CurrNode = MainScene.GetNodeByName(name);
            ClassNode nodenec;
            do
            {
                nodenec = CurrNode.LstNodes[CurrentArc];
                if (nodenec.TypeN == TypeNode.Scene)
                    GoRoundOfScene(nodenec.Name);
                else
                {
                    if (nodenec.CaseFrame.ToDo.Name == Destroy)
                        nodenec.CaseFrame.Recipient.IsDestroyed = true;
                    Fairytale += nodenec.GetText();
                }
                CurrentArc++;
            } while (CurrentArc < CurrNode.LstNodes.Count);
        }
        //========================генерация текста==========================================================================
    }
}
